$('.photos-edit').livequery(function() {
	$('.main-photo').click(function() {
		var photoId = $(this).closest('.photo-contain').data('photo-id');
		
		$.ajax({  
			type: "POST",  
			url: W_AJAX + "photo/main",  
			data: {
				ID_photo: photoId
			},
			dataType: "json",
			success: function(objData) {
				if (objData.result == 'OK') window.location.reload();
				else App.showError(objData.error);
			}
		});
		
		return false;
	});
	
	$('.delete-photo').click(function() {
		var photoId = $(this).closest('.photo-contain').data('photo-id');
		
		$.ajax({  
			type: "POST",  
			url: W_AJAX + "photo/delete",  
			data: {
				ID_photo: photoId
			},
			dataType: "json",
			success: function(objData) {
				if (objData.result == 'OK') window.location.reload();
				else App.showError(objData.error);
			}
		});
		
		return false;
	});
});